home *** CD-ROM | disk | FTP | other *** search
- /*
- IC Window Globals.c
-
- */
-
- #include <Files.h>
- #include <Windows.h>
-
- #include "IC Types.h"
- #include "IC Misc Subs.h"
- #include "IC Document.h"
-
- #include "IC Window Globals.h"
-
- #include "IC Globals.h"
-
- short WT_Last;
-
- WindowInfoRec** gWindowsInfoHandle;
- WindowInfoRec* WindowInfo;
- WhatInfoRec WhatInfo[whats_max];
-
- short GetSelectedItem(WindowType wt){
- short selected_item;
-
- selected_item=WindowInfo[wt].selected_item;
-
- if ((selected_item>0)&&(WindowInfo[wt].items[selected_item]!=(WhatRecordPtr)0)&&(WindowInfo[wt].items[selected_item]->typ=='TEXT'))
- return selected_item;
-
- return -1;
- }
-
- WindowType GetWindowType(WindowPtr wp){
- WindowType i;
-
- if (wp!=(WindowPtr)0){
- for (i=WT_None;i<WT_Last;i++){
- if (WindowInfo[i].window==wp)
- return i;
- }
- }
-
- return WT_None;
- }
-
- void ProcessAttributes(WindowType wt,short item,long attr){
-
- if ((attr!=ICattr_no_change)&&(attr&ICattr_locked_bit))
- WindowInfo[wt].items[item]->flags &= wf_locked;
- }
-
- Boolean IsLocked(WindowType wt,short item){
- Boolean lck;
-
- lck=WindowInfo[wt].items[item]->flags & (1<<wf_locked);
-
- return ((lck)||(IsDocLocked()));
- }
-
- void LockedAlert(WindowType wt,short item){
- static WindowType last_alert_wt=WT_None;
- static short last_alert_item=-1;
-
- if ((wt!=last_alert_wt)||(item!=last_alert_item)){
- ResetAlertStage();
- last_alert_wt=wt;
- last_alert_item=item;
- }
-
- InitCursor();
-
- StopAlert(143,(ModalFilterUPP)0);
- }
-
- /*
- InitICWindowGlobals
-
- Just a few additions here that were not in the pascal source. The first item
- is a call to InitUniversals(), which sets up global UniversalProcPtrs that can be used
- repeatedly without having to recreate them over and over.
-
- The second item the dynamic creation of the WindowsInfo[] array. This will allow a
- non-programmer type to add windows to the application without having to modify and
- recompile.
- */
- void InitICWindowGlobals(void){
- // Initialize the callbacks
- InitUniversals();
-
- UseResFile(app_resfile);
- WT_Last=Count1Resources('WHAT')+2; // count the WHAT resources in the app
-
- gWindowsInfoHandle=(WindowInfoRec**)NewHandle(sizeof(WindowInfoRec)*WT_Last);
- HLockHi((Handle)gWindowsInfoHandle);
- WindowInfo=*gWindowsInfoHandle;
- }
-
-
-
-